package tpl

const TplScript = `
{{$opcln := clsname .ParamOut.Classpath}}
package {{package .Classpath}};

import com.psbc.cbcbp.base.interfaces.IAtom;
import com.psbc.cbcbp.base.inner.InnerRespDTO;
import com.psbc.cbcbp.base.inner.InnerReqDTO;
import com.psbc.cbcbp.context.OrchContext;
import com.psbc.cbcbp.context.OrchContextHolder;
import org.springframework.stereotype.Service;
import java.util.Map;
import {{.ParamIn.Classpath}};
import {{.ParamOut.Classpath}};

@Service
public class {{clsname .Classpath}} implements IAtom<{{clsname .ParamOut.Classpath}}, {{clsname .ParamIn.Classpath}}>{

	@Override
	public InnerRespDTO<{{clsname .ParamOut.Classpath}}> doAtom(InnerReqDTO<{{clsname .ParamIn.Classpath}}> reqDTO){
		InnerRespDTO<{{clsname .ParamOut.Classpath}}> responseDTO = new InnerRespDTO();
		{{$opcln}} {{lower $opcln}} = new {{$opcln}}();
		try{
			OrchContext orchContext = OrchContextHolder.getOrchContext();

			/** orchContext usr demo begin**/
			//获取编排服务入参 FinsIn为编排服务入参泛型实际类型 需要自行import到脚本中
			//InnerReqDTO<FinsIn> finsIn = orchContext.getFinsReqDTO();
			//根据原子服务名称获取入参DTO 需要对InnerReqDTO.data做类型转换
			//InnerReqDTO<? extends AtomData> atomReqDto = orchContext.getAtomReqDtoByName("原子服务名称").get(0);
			//根据原子服务名称获取入参DTO 需要对InnerRespDTO.data做类型转换
			//InnerRespDTO<? extends AtomData> atomRespDto = orchContext.getAtomRespDtoByName("原子服务名称").get(0);
			/** orchContext usr demo end**/

			/** now! show your source below **/

		} catch(Exception e) {
			responseDTO.setCode("999999999");
			responseDTO.setMsg("script exec fail");
		}

		return responseDTO;
	}
}
`
